<?php
/**
 * Created by PhpStorm.
 * User: 86158
 * Date: 2021/6/28
 * Time: 16:28
 */

namespace App\Admin\Controllers\access;


use App\Models\access\AccessVoteMember;
use Encore\Admin\Controllers\AdminController;
use James\Admin\Actions;
use James\Admin\Grid;

class AccessVoteMemberController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = '考核成员结果';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new AccessVoteMember());
        $grid->model()->where('is_del',0);
        $grid->disableCreateButton();
        $grid->disableActions();
        $grid->disableExport();
//        $grid->actions(function (Actions $actions) {
//            $actions->disableView();
//            $actions->disableEdit();
//            $actions->disableDelete();
//        });
        $grid->filter(function ($filter) {
            // 去掉默认的id过滤器
            $filter->disableIdFilter();
            $filter->equal('access_id', '考核ID');
            $filter->equal('user.name', '成员姓名');
        });
        $grid->column('access.title',__('Title'));
        $grid->column('score',__('得分'));
        $grid->column('user.name',__('成员'));
        $grid->column('status',__('考核状态'))->using([
            0 => '未考核完成',
            1 => '已考核完成'
        ]);
        return $grid;
    }
}